<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台-菜单管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="../../../css/base/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="../../../css/base/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../../../css/base/animate.min.css" rel="stylesheet">
    <link href="../../../css/plugins/table/bootstrap-table.css" rel="stylesheet"/>
    <link href="../../../css/plugins/alert/messager.css" rel="stylesheet"/>
    <link href="../../../css/plugins/jquery/jquery.treegrid.css" rel="stylesheet"/>
    <link href="../../../css/plugins/icheck/orange.css" rel="stylesheet">
    <link href="../../../css/style-main.css" rel="stylesheet">
    <link href="../../../css/style.css" rel="stylesheet">
    <!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <style type="text/css">
        tr:hover {
            background-color: #F9F9F9;
        }

        .indexMask{
            width: 100%; height: 100%; position: fixed; left: 0px; top: 0px; z-index: 9999999; display: none; background: #7c7979;opacity: 0.8;
        }
        .indexMask2{
            position: absolute;top: 50%;left: 50%;margin: -50px 0px 0px -50px;width:100px;height: 100px;z-index: 99999;border-radius: 10px;
        }
    </style>
</head>

<body class="gray-bg" data-js="../../../js/module/base/meta_Org">
<!-- 加载等待层 -->
<div id="indexMask" class="indexMask">
    <div class="indexMask2" >
        <img src="../../../img/timg.gif" style="width: 100%;display: block;">
    </div>
</div>

<div class="row white-bg dashboard-header">
    <div class="col-sm-12">
    </div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <div id="main_div" class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>列表</h5>
            </div>
            <div class="ibox-content">
                <!-- page start-->
                <div id="search-toolbar" class="search-toolbar">
                    <div class="form-inline" role="form">
                        <div class="form-group">
                            <input type="text" class="form-control" id="s_OrgVersionId" placeholder="请选择组织机构版本" readonly="readonly" />
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-search" id="btn_search"><i class="fa fa-search"> </i> 搜索</button>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <section class="panel">
                            <div id="org_list">
                                <!-- 绑定菜单数据 -->
                            </div>
                        </section>
                    </div>
                </div>

                <!-- 模版语法 -->
                <script type="text/template" id="tmpl_org_list">
                    <div class="col-sm-12 text-right">
                        <button onclick="javascript:$('#org_tree').treegrid('expandAll');" class="btn btn-white btn-sm"><i
                                class="fa fa-plus-square-o"></i> 全部展开
                        </button>
                        <button onclick="javascript:$('#org_tree').treegrid('collapseAll');" class="btn btn-white btn-sm"><i
                                class="fa fa-minus-square-o"></i> 全部折叠
                        </button>
<!--                                                <button onclick="javascript:location.reload()" class="btn btn-white btn-sm"><i-->
<!--                                                        class="fa fa-refresh"></i> 刷新组织架构-->
<!--                                                </button>-->
                        <button onclick="BASE.Org.addChild(0)" class="btn btn-add btn-sm"><i
                                class="fa fa-plus"></i> 增加一级组织架构
                        </button>
                    </div>
                    <table class="table" id="org_tree">
                        <thead>
                        <tr>
                            <th width="20%">组织架构名称</th>
                            <th width="20%">标识</th>
                            <th width="20%">节点所在层级</th>
                            <th width="20%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <!-- 数组迭代 -->
                        {{~it:value:index}}
                            <tr class="treegrid-{{= value.Id}}">
                                <td>{{= value.Name}}</td>
                                <td>
                                    {{if(value.Flag==0){}}集团{{}}}
                                    {{if(value.Flag==1){}}三大中心{{}}}
                                    {{if(value.Flag==2){}}营销中心{{}}}
                                    {{if(value.Flag==3){}}生产中心{{}}}
                                    {{if(value.Flag==4){}}保障中心{{}}}
                                    {{if(value.Flag==5){}}其他{{}}}
                                </td>
                                <td>{{= value.NodeLevel}}</td>
                                <td>
                                    {{if(value.Id > 0){}}
                                    <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= value.Id}}')"
                                       class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                    <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= value.Id}}')"
                                       class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                    <a href="javascript:void(0)"
                                       onclick="BASE.Org.addChild('{{= value.Id}}','{{= value.NodeLevel}}','{{= value.OrgVersionId}}')"
                                       class="text-do-add"><i class="fa fa-plus"> 增加</i></a>

                                    <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= value.Id}}')"
                                       class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                    <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= value.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                    {{}}}
                                </td>
                            </tr>
                            {{if(value.children && value.children.length>0) {}}
                            {{~value.children:val:num}}
                                <tr class="treegrid-{{= val.ParentId}}-{{= val.Id}} treegrid-parent-{{= val.ParentId}}">
                                    <td>{{= val.Name}}</td>
                                    <td>
                                        {{if(val.Flag==0){}}集团{{}}}
                                        {{if(val.Flag==1){}}三大中心{{}}}
                                        {{if(val.Flag==2){}}营销中心{{}}}
                                        {{if(val.Flag==3){}}生产中心{{}}}
                                        {{if(val.Flag==4){}}保障中心{{}}}
                                        {{if(val.Flag==5){}}其他{{}}}
                                    </td>
                                    <td>{{= val.NodeLevel}}</td>
                                    <td>
                                        {{if(value.Id > 0){}}
                                        <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= val.Id}}')"
                                           class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                        <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= val.Id}}')"
                                           class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                        <a href="javascript:void(0)"
                                           onclick="BASE.Org.addChild('{{= val.Id}}','{{= val.NodeLevel}}','{{= val.OrgVersionId}}')"
                                           class="text-do-add"><i class="fa fa-plus"> 增加</i></a>


                                        <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= val.Id}}')"
                                           class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                        <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= val.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                        {{}}}
                                    </td>
                                </tr>
                                {{if(val.children && val.children.length>0) {}}
                                {{~val.children:v:n}}
                                    <tr class="treegrid-{{=v.ParentId}}-{{=v.Id}} treegrid-parent-{{=val.ParentId}}-{{= v.ParentId}}">
                                        <td> &nbsp; {{= v.Name}}</td>
                                        <td>
                                            {{if(v.Flag==0){}}集团{{}}}
                                            {{if(v.Flag==1){}}三大中心{{}}}
                                            {{if(v.Flag==2){}}营销中心{{}}}
                                            {{if(v.Flag==3){}}生产中心{{}}}
                                            {{if(v.Flag==4){}}保障中心{{}}}
                                            {{if(v.Flag==5){}}其他{{}}}
                                        </td>
                                        <td>{{= v.NodeLevel}}</td>
                                        <td>
                                            {{if(v.Id > 0){}}
                                            <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= v.Id}}')"
                                               class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                            <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= v.Id}}')"
                                               class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                            <a href="javascript:void(0)"
                                               onclick="BASE.Org.addChild('{{= v.Id}}','{{= v.NodeLevel}}','{{= v.OrgVersionId}}')"
                                               class="text-do-add"><i class="fa fa-plus"> 增加</i></a>

                                            <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= v.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                            <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= v.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                            {{}}}
                                        </td>
                                    </tr>
                                    {{if(v.children && v.children.length>0) {}}
                                    {{~v.children:vv:nn}}
                                        <tr class="treegrid-{{=vv.ParentId}}-{{= vv.Id}} treegrid-parent-{{= v.ParentId}}-{{= vv.ParentId}}">
                                            <td> &nbsp;&nbsp;{{= vv.Name}}</td>
                                            <td>
                                                {{if(vv.Flag==0){}}集团{{}}}
                                                {{if(vv.Flag==1){}}三大中心{{}}}
                                                {{if(vv.Flag==2){}}营销中心{{}}}
                                                {{if(vv.Flag==3){}}生产中心{{}}}
                                                {{if(vv.Flag==4){}}保障中心{{}}}
                                                {{if(vv.Flag==5){}}其他{{}}}
                                            </td>
                                            <td>{{= vv.NodeLevel}}</td>
                                            <td>
                                                {{if(vv.Id > 0){}}
                                                <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= vv.Id}}')"
                                                   class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                                <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= vv.Id}}')"
                                                   class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                                <a href="javascript:void(0)"
                                                   onclick="BASE.Org.addChild('{{= vv.Id}}','{{= vv.NodeLevel}}','{{= vv.OrgVersionId}}')"
                                                   class="text-do-add"><i class="fa fa-plus"> 增加</i></a>

                                                <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= vv.Id}}')"
                                                   class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                                <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= vv.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                                {{}}}
                                            </td>
                                        </tr>
                                        {{if(vv.children && vv.children.length>0) {}}
                                        {{~vv.children:vvv:nnn}}
                                            <tr class="treegrid-{{= vvv.ParentId}}-{{= vvv.Id}} treegrid-parent-{{= vv.ParentId}}-{{= vvv.ParentId}}">
                                            <td> &nbsp;&nbsp;&nbsp; {{= vvv.Name}}</td>
                                            <td>
                                                {{if(vvv.Flag==0){}}集团{{}}}
                                                {{if(vvv.Flag==1){}}三大中心{{}}}
                                                {{if(vvv.Flag==2){}}营销中心{{}}}
                                                {{if(vvv.Flag==3){}}生产中心{{}}}
                                                {{if(vvv.Flag==4){}}保障中心{{}}}
                                                {{if(vvv.Flag==5){}}其他{{}}}
                                            </td>
                                            <td>{{= vvv.NodeLevel}}</td>
                                            <td>
                                                {{if(vvv.Id > 0){}}
                                                <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= vvv.Id}}')"
                                                   class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                                <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= vvv.Id}}')"
                                                   class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>
                                                <a href="javascript:void(0)"
                                                   onclick="BASE.Org.addChild('{{= vvv.Id}}','{{= vvv.NodeLevel}}','{{= vvv.OrgVersionId}}')"
                                                   class="text-do-add"><i class="fa fa-plus"> 增加</i></a>

                                                <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= vvv.Id}}')"
                                                   class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                                <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= vvv.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                                {{}}}
                                            </td>
                                        </tr>
                                            {{if(vvv.children && vvv.children.length>0) {}}
                                            {{~vvv.children:vvvv:nnnn}}
                                                <tr class="treegrid-parent-{{= vvv.ParentId}}-{{= vvvv.ParentId}}">
                                                <td> &nbsp;&nbsp;&nbsp;&nbsp; {{= vvvv.Name}}</td>
                                                <td>
                                                    {{if(vvvv.Flag==0){}}集团{{}}}
                                                    {{if(vvvv.Flag==1){}}三大中心{{}}}
                                                    {{if(vvvv.Flag==2){}}营销中心{{}}}
                                                    {{if(vvvv.Flag==3){}}生产中心{{}}}
                                                    {{if(vvvv.Flag==4){}}保障中心{{}}}
                                                    {{if(vvvv.Flag==5){}}其他{{}}}
                                                </td>
                                                <td>{{= vvvv.NodeLevel}}</td>
                                                <td>
                                                    {{if(vvvv.Id > 0){}}
                                                    <a href="javascript:void(0)" onclick="BASE.Org.edit('{{= vvvv.Id}}')"
                                                       class="text-do-edit"><i class="fa fa-pencil"></i> 编辑</a>
                                                    <a href="javascript:void(0)" onclick="BASE.Org.delete('{{= vvvv.Id}}')"
                                                       class="text-do-remove"><i class="fa fa-trash"></i> 删除</a>

                                                    <a href="javascript:void(0)" onclick="BASE.Org.toOrgIncomeCompany('{{= vvvv.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 收入成本</i></a>
                                                    <a href="javascript:void(0)" onclick="BASE.Org.toOrgFeeCompanyCostCenter('{{= vvvv.Id}}')" class="text-do-add"><i class="fa fa-file-text-o"> 费用</i></a>
                                                    {{}}}
                                                </td>
                                            </tr>
                                            {{~}}
                                            {{}}}
                                        {{~}}
                                        {{}}}
                                    {{~}}
                                    {{}}}
                                {{~}}
                                {{}}}
                            {{~}}
                            {{}}}
                        {{~}}
                        </tbody>
                    </table>
                </script>
                <!-- page end-->
            </div>
        </div>
    </div>

    <!-- 公司相关 -->
    <div id="company_div" class="row" style="display: none">
        <div class="col-sm-12">
            <div class="ibox-title">
                <!--                <h5>列表</h5>-->
                <div class="ibox-tools">
                    <a class="back_list" href="javascript:void(0)">
                        <i class="fa fa-reply"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div id="search-toolbar-company" class="search-toolbar">
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <button id="btn_add_company" class="btn btn-add"><i class="fa fa-plus"></i> 增加公司</button>
                            </div>
                        </div>
                    </div>
                    <table id="myTable1" data-click-to-select="true" data-show-add="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true">

                    </table>
                </div>
            </div>
        </div>
    </div>
    <!-- 成本 -->
    <div id="costCenter_div" class="row" style="display: none">
        <div class="col-sm-12">
            <div class="ibox-title">
                <!--                <h5>列表</h5>-->
                <div class="ibox-tools">
                    <a class="back_list" href="javascript:void(0)">
                        <i class="fa fa-reply"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div id="search-toolbar-costCenter" class="search-toolbar">
                        <div class="form-inline" role="form">
                            <div class="form-group">
                                <button id="btn_add_costCenter" class="btn btn-add"><i class="fa fa-plus"></i> 增加费用</button>
                            </div>
                        </div>
                    </div>
                    <table id="myTable2" data-click-to-select="true" data-show-add="true" data-show-refresh="true" data-show-toggle="true" data-show-columns="true">

                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑组织架构</h4>
            </div>
            <form id="fm" method="post" class="form-horizontal" role="form">
                <input type="hidden" id="_id" name="_id"/>
                <input type="hidden" id="OrgVersionId" name="OrgVersionId"/>
                <input type="hidden" id="parent_id" name="parent_id"/>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">组织架构名称</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="Name" name="Name" placeholder="请输入组织架构名称"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">标识</label>
                        <div class="col-sm-8">
                            <div class="radio i-checks">
                                <label style="margin-top: 10px;"><input type="radio" value="0" name="Flag" checked><i></i> 集团</label>
                                <br />
                                <label style="margin-top: 10px;"><input type="radio" value="1" name="Flag"><i></i> 三大中心</label>
                                <br />
                                <label style="margin-top: 10px;"><input type="radio" value="2" name="Flag"><i></i> 营销中心</label>
                                <br />
                                <label style="margin-top: 10px;"><input type="radio" value="3" name="Flag"><i></i> 生产中心</label>
                                <br />
                                <label style="margin-top: 10px;"><input type="radio" value="4" name="Flag"><i></i> 保障中心</label>
                                <br />
                                <label style="margin-top: 10px;"><input type="radio" value="5" name="Flag"><i></i> 其他</label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">节点所在层级</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="NodeLevel" name="NodeLevel" disabled="disabled" placeholder="请输入节点所在层级" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">顺序</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="sort" name="sort" placeholder="请输入顺序" value="1"/>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-main">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- 公司 -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <form id="fm_company" method="post" class="form-horizontal" role="form">
                <input type="hidden" id="OrgId" name="OrgId"/>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">公司</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="CompanyId" name="CompanyId" placeholder="请选择公司"/>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-main">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- 成本 -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">编辑</h4>
            </div>
            <form id="fm_costCenter" method="post" class="form-horizontal" role="form">
                <input type="hidden" id="OrgId2" name="OrgId2"/>

                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">公司</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="CompanyId2" name="CompanyId2" placeholder="请选择公司"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">费用</label>

                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="CostCenterId" name="CostCenterId" placeholder="请选择费用"/>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-main">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="../../../js/base/require.min.js" defer="" data-main="../../../js/main"></script>

</body>

</html>